package com.yjhh.scala

/**
  *
  *
  *
  */
object HelloImplicits {

  class Man(val name: String)

  object Man {
    //假如了隐式转化就可以调用SuperMan中的方法了
    implicit def man2SuperMan(man: Man) = new SuperMan(man.name)
  }

  class SuperMan(val name: String) {
    def makeMiracles = println(this.name + "Wow,Wow,Wow...")
  }

  def main(args: Array[String]): Unit = {
    new Man("Scala").makeMiracles

    implicit val content : String = "Java"
    talk("Scala")("Spark")
    talk("Scala")          //隐式参数转化
  }

  def talk(title: String)(implicit content: String) = println(title + "   " + content)

}
